package com.zp.self.module.level_1_问道.II_集合问题;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author ：ZengPeng
 * @date ：Created 2022/5/30 20:32
 * @description : 查看HashMap的源码
 */
public class II_4_LinkedHashMap_LRU<K,V> extends LinkedHashMap<K,V>{
    private final int capacity;

    public II_4_LinkedHashMap_LRU(int capacity) {
        super(capacity, 0.75f, true);
        this.capacity = capacity;
    }

    @Override
    protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
        return size()>capacity;
    }
}
